def makeGood(s: str) -> str:  
    stack = []  
      
    for char in s:  
        # 检查栈是否为空或者栈顶字符与当前字符不构成大小写对应关系  
        if not stack or abs(ord(stack[-1]) - ord(char)) != 32:  
            stack.append(char)  
        else:  
            stack.pop()  # 弹出栈顶字符
      
    # 将栈中的字符连接成字符串返回  
    return ''.join(stack)  
  

s1 = "leEeetcode"  
s2 = "abBAcC"  
print(makeGood(s1))  
print(makeGood(s2)) 